package fr.inserm.um915.bdibd.model;

import com.sleepycat.bind.tuple.TupleBinding;
import com.sleepycat.bind.tuple.TupleInput;
import com.sleepycat.bind.tuple.TupleOutput;

public class IBDStatus
	{
	float ibd0;
	float ibd1;
	float ibd2;
	
	static public class Binding extends TupleBinding<IBDStatus>
		{
		@Override
		public IBDStatus entryToObject(TupleInput in)
			{
			float i0=in.readFloat();
			float i1=in.readFloat();
			float i2=in.readFloat();
			return new IBDStatus(i0,i1,i2);
			}
		@Override
		public void objectToEntry(IBDStatus o, TupleOutput out)
			{
			out.writeFloat(o.ibd0);
			out.writeFloat(o.ibd1);
			out.writeFloat(o.ibd2);
			}
		}
	
	public static final Binding BINDING=new Binding();
	
	
	public IBDStatus()
		{
		this(-1.0f,-1.0f,-1.0f);
		}
	
	public IBDStatus(float ibd0,float ibd1,float ibd2)
		{
		this.ibd0=ibd0;
		this.ibd1=ibd1;
		this.ibd2=ibd2;
		}
	public float getIbd(int index)
		{
		switch(index)
			{
			case 0: return ibd0;
			case 1: return ibd1;
			case 2: return ibd2;
			default: throw new IllegalArgumentException("index:"+index);
			}
		}
	
	public float getIbd0() {
		return ibd0;
	}

	public float getIbd1() {
		return ibd1;
	}

	public float getIbd2() {
		return ibd2;
	}
	
	@Override
	public String toString() {
		return "("+ibd0+","+ibd1+","+ibd2+")";
		}
	}
